{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-01-31T13:33:06.392952800Z",
     "start_time": "2024-01-31T13:33:06.136721200Z"
    }
   },
   "outputs": [],
   "source": [
    "from pondmemory.database.Mongo import Mongo\n",
    "mongo = Mongo('localhost', 27017, 'PondMemoryDB')"
   ]
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "2024-01-31 21:33:06,402 - INFO: 与MongoDB localhost:27017 建立连接\n"
     ]
    }
   ],
   "source": [
    "m_collection = \"WechatMsg\"\n",
    "res = list(mongo.find(m_collection, {\"Type\":1}))"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-31T13:33:06.620127Z",
     "start_time": "2024-01-31T13:33:06.393941100Z"
    }
   },
   "execution_count": 2
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Building prefix dict from the default dictionary ...\n",
      "Loading model from cache C:\\Users\\killuayz\\AppData\\Local\\Temp\\jieba.cache\n",
      "Loading model cost 0.658 seconds.\n",
      "Prefix dict has been built successfully.\n"
     ]
    }
   ],
   "source": [
    "import jieba \n",
    "jieba.load_userdict(\"pondmemory/cut_words/SogouLabDic.txt\")\n",
    "jieba.load_userdict(\"pondmemory/cut_words/dict_baidu_utf8.txt\")\n",
    "jieba.load_userdict(\"pondmemory/cut_words/dict_pangu.txt\")\n",
    "jieba.load_userdict(\"pondmemory/cut_words/dict_sougou_utf8.txt\")\n",
    "jieba.load_userdict(\"pondmemory/cut_words/dict_tencent_utf8.txt\")\n",
    "\n"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-31T13:33:20.013429800Z",
     "start_time": "2024-01-31T13:33:06.621111500Z"
    }
   },
   "execution_count": 3
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "jieba.load_userdict(\"pondmemory/cut_words/my_dict.txt\")"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-31T13:33:20.025158800Z",
     "start_time": "2024-01-31T13:33:20.015430400Z"
    }
   },
   "execution_count": 4
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "stopwords = {}.fromkeys([ line.rstrip() for line in open('pondmemory/cut_words/Stopword.txt', encoding='utf8') ])"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-31T13:33:20.029257600Z",
     "start_time": "2024-01-31T13:33:20.022162200Z"
    }
   },
   "execution_count": 5
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "cut_words_list = []\n",
    "for msg in res:\n",
    "    content = msg[\"StrContent\"]\n",
    "    seg_list = list(jieba.cut(content, cut_all=False))\n",
    "    for seg in seg_list:\n",
    "        if seg not in stopwords and not seg.isspace():\n",
    "            cut_words_list.append(seg)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-31T13:33:22.019161800Z",
     "start_time": "2024-01-31T13:33:20.031255800Z"
    }
   },
   "execution_count": 6
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "#1          xinxin          3918      \n",
      "#2          可怜              3458      \n",
      "#3          害羞              2396      \n",
      "#4          阳哥              1709      \n",
      "#5          旺柴              1308      \n",
      "#6          破涕为笑            1261      \n",
      "#7          亲亲              1120      \n",
      "#8          晚安              1117      \n",
      "#9          捂脸              1088      \n",
      "#10         呆头鹅             833       \n",
      "#11         dte             776       \n",
      "#12         dde             711       \n",
      "#13         苦涩              687       \n",
      "#14         流泪              507       \n",
      "#15         yg              490       \n",
      "#16         猫宁              488       \n",
      "#17         明天              483       \n",
      "#18         呆呆鹅             410       \n",
      "#19         衰               352       \n",
      "#20         今晚              336       \n"
     ]
    }
   ],
   "source": [
    "cut_words_map_cnt = {}\n",
    "for word in cut_words_list:\n",
    "    if word not in cut_words_map_cnt:\n",
    "        cut_words_map_cnt[word] = 1\n",
    "    else:\n",
    "        cut_words_map_cnt[word] += 1\n",
    "\n",
    "cut_words_map_cnt_list = list(cut_words_map_cnt.items())\n",
    "cut_words_map_cnt_list.sort(key=lambda x: x[1], reverse=True)\n",
    "# print(cut_words_map_cnt_list)\n",
    "for i in range(min(20, len(cut_words_map_cnt_list))):\n",
    "    print(f\"#{i+1:<10d} {cut_words_map_cnt_list[i][0]:<15s} {cut_words_map_cnt_list[i][1]:<10d}\")\n",
    "    "
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-31T13:33:22.077561Z",
     "start_time": "2024-01-31T13:33:22.022272200Z"
    }
   },
   "execution_count": 7
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-31T13:33:22.078566Z",
     "start_time": "2024-01-31T13:33:22.071036100Z"
    }
   },
   "execution_count": 7
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 161126/161126 [00:19<00:00, 8207.04it/s]\n"
     ]
    }
   ],
   "source": [
    "from pondmemory.sentiment.evaulate_sentiment import evaulate_sentiment\n",
    "pos_words_list, neg_words_list = evaulate_sentiment(cut_words_list)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-31T13:33:44.273863800Z",
     "start_time": "2024-01-31T13:33:22.075560800Z"
    }
   },
   "execution_count": 8
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": "[('😁', 0.5),\n ('我想', 0.5441789912779675),\n ('米', 0.5038759689922481),\n ('测', 0.7499999999999999),\n ('补测', 0.5),\n ('机会', 0.7541666666666667),\n ('苦涩', 0.875),\n ('苦涩', 0.875),\n ('苦涩', 0.875),\n ('苦涩', 0.875),\n ('苦涩', 0.875),\n ('苦涩', 0.875),\n ('我刚刚', 0.5918367346938779),\n ('老师', 0.8788819875776398),\n ('看看你', 0.5262327818078083),\n ('缓测', 0.5),\n ('后续', 0.5999999999999999),\n ('统一', 0.6785714285714288),\n ('组织', 0.7272727272727275),\n ('测试', 0.7244094488188978),\n ('等一下', 0.5262327818078083),\n ('要样', 0.5),\n ('缓测', 0.5),\n ('嘿哈', 0.5262327818078083),\n ('你可以', 0.5262327818078083),\n ('缓测', 0.5),\n ('过会儿', 0.7499999999999999),\n ('哦哦哦', 0.5262327818078083),\n ('好滴', 0.6644044980400812),\n ('我猜', 0.6578947368421054),\n ('概率', 0.5),\n ('会让你', 0.5539033457249072),\n ('通过的', 0.5262327818078083),\n ('感谢', 0.6911764705882352),\n ('合十', 0.5),\n ('合十', 0.5),\n ('体委', 0.5),\n ('就去', 0.5131611932815242),\n ('试', 0.59375),\n ('对了', 0.5262327818078083),\n ('记得', 0.7848837209302325),\n ('更要', 0.6241768579492005),\n ('下次', 0.5689851767388825),\n ('体委', 0.5),\n ('皱眉', 0.5),\n ('那你', 0.5262327818078083),\n ('等一下', 0.5262327818078083),\n ('老师', 0.8788819875776398),\n ('蟹蟹', 0.890142453148024),\n ('画', 0.6165413533834587),\n ('图', 0.6198830409356725),\n ('放在', 0.5384615384615385),\n ('研究', 0.8121546961325968),\n ('思路', 0.7450980392156863),\n ('设计', 0.6876006441223831),\n ('路线', 0.7619047619047622),\n ('奥奥', 0.9540079860204392),\n ('好滴', 0.6644044980400812),\n ('okay', 0.5262327818078083),\n ('我想', 0.5441789912779675),\n ('宿舍', 0.692307692307692),\n ('低头', 0.7272727272727275),\n ('看了', 0.5875212430201505),\n ('手机', 0.559322033898305),\n ('强', 0.6761229314420805),\n ('高代', 0.5),\n ('微笑', 0.7608695652173911),\n ('微笑', 0.7608695652173911),\n ('放弃了', 0.6500000000000002),\n ('矩阵', 0.5),\n ('我就', 0.5262327818078083),\n ('正则', 0.5),\n ('我就', 0.5262327818078083),\n ('心碎', 0.9090909090909091),\n ('ppt', 0.7499999999999999),\n ('做完', 0.7363911147477495),\n ('东西', 0.5285524568393094),\n ('来写', 0.523295070898042),\n ('en', 0.5),\n ('en', 0.5),\n ('皱眉', 0.5),\n ('放在', 0.5384615384615385),\n ('软件设计', 0.606377198765038),\n ('算法', 0.8999999999999999),\n ('分析', 0.8846153846153847),\n ('特地', 0.6499999999999999),\n ('下了', 0.5041975308641975),\n ('记得', 0.7848837209302325),\n ('献血', 0.7499999999999999),\n ('旺柴', 0.8253755044676468),\n ('献血', 0.7499999999999999),\n ('疫情', 0.5),\n ('旺柴', 0.8253755044676468),\n ('旺柴', 0.8253755044676468),\n ('hjh', 0.5),\n ('还好', 0.6986352350530262),\n ('一嘴', 0.5454545454545455),\n ('忘记', 0.6595744680851064),\n ('hhhhhhhhhh', 0.5),\n ('你在哪里', 0.5262327818078083),\n ('旺柴', 0.8253755044676468),\n ('还会', 0.6016513883680766),\n ('拉', 0.5093167701863355),\n ('群', 0.5151515151515154),\n ('thx', 0.5),\n ('这一', 0.5262327818078083),\n ('2020', 0.5),\n ('年', 0.5492584745762712),\n ('中共中央', 0.5),\n ('法治', 0.5),\n ('中国', 0.7349726775956282),\n ('2020', 0.5),\n ('2025', 0.5),\n ('年', 0.5492584745762712),\n ('践行', 0.523409627708693),\n ('为了维护', 0.5555555555555554),\n ('社会治安', 0.769692533856882),\n ('保护', 0.6153846153846152),\n ('弱小', 0.6666666666666666),\n ('希望', 0.562893081761006),\n ('AI', 0.5),\n ('更多', 0.6241768579492005),\n ('妇女儿童', 0.7856609738518149),\n ('免遭', 0.5),\n ('亲人', 0.7631578947368421),\n ('分离', 0.9375),\n ('之苦', 0.52),\n ('更多', 0.6241768579492005),\n ('拐卖', 0.5),\n ('孩子', 0.7684069611780455),\n ('回家', 0.7536231884057972),\n ('学习', 0.8347457627118644),\n ('计算机科学', 0.849827903906632),\n ('学生', 0.7037037037037036),\n ('造福', 0.5999999999999999),\n ('社会', 0.787781350482315),\n ('理想', 0.5736434108527133),\n ('这一', 0.5262327818078083),\n ('2020', 0.5),\n ('年', 0.5492584745762712),\n ('中共中央', 0.5),\n ('法治', 0.5),\n ('中国', 0.7349726775956282),\n ('2020', 0.5),\n ('2025', 0.5),\n ('年', 0.5492584745762712),\n ('践行', 0.523409627708693),\n ('希望', 0.562893081761006),\n ('AI', 0.5),\n ('维护', 0.5555555555555554),\n ('社会治安', 0.769692533856882),\n ('保护', 0.6153846153846152),\n ('弱小', 0.6666666666666666),\n ('学习', 0.8347457627118644),\n ('计算机科学', 0.849827903906632),\n ('学生', 0.7037037037037036),\n ('造福', 0.5999999999999999),\n ('社会', 0.787781350482315),\n ('理想', 0.5736434108527133),\n ('你有', 0.5262327818078083),\n ('做', 0.6116015132408574),\n ('逻辑', 0.6233766233766236),\n ('回归', 0.9444444444444444),\n ('刚做完', 0.7142978364979734),\n ('选了', 0.6456953642384105),\n ('数据', 0.6078431372549018),\n ('集', 0.6627906976744187),\n ('苦涩', 0.875),\n ('分类', 0.764705882352941),\n ('用了', 0.5262327818078083),\n ('特别', 0.606392694063927),\n ('顺手', 0.5999999999999999),\n ('可视化', 0.5),\n ('我就', 0.5262327818078083),\n ('分类', 0.764705882352941),\n ('效果', 0.6291739894551844),\n ('还可以', 0.5746682977321914),\n ('准确率', 0.5),\n ('是呢', 0.5262327818078083),\n ('上次', 0.5099999999999996),\n ('线性', 0.5),\n ('很高', 0.7813444220638037),\n ('散点图', 0.5948433373448726),\n ('都在', 0.5512110016420362),\n ('一条', 0.5420560747663552),\n ('带上', 0.5706792787833659),\n ('旺柴', 0.8253755044676468),\n ('接受', 0.546808510638298),\n ('le', 0.7499999999999999),\n ('你怎么', 0.5262327818078083),\n ('也换', 0.5),\n ('高中同学', 0.8514885509260093),\n ('喊', 0.5517241379310347),\n ('她也', 0.5262327818078083),\n ('朱怡', 0.9557662906845337),\n ('我去', 0.5131611932815242),\n ('414', 0.5),\n ('3Q', 0.5),\n ('嘲笑', 0.8571428571428571),\n ('旺柴', 0.8253755044676468),\n ('这是', 0.5262327818078083),\n ('宫廷', 0.5555555555555554),\n ('太乐', 0.5),\n ('Emm', 0.5),\n ('Emm', 0.5),\n ('hjh', 0.5),\n ('确实', 0.6538461538461541),\n ('好乐', 0.5),\n ('zyj', 0.5),\n ('嘲笑', 0.8571428571428571),\n ('Emm', 0.5),\n ('信息', 0.5),\n ('黑化', 0.5),\n ('版', 0.5617283950617286),\n ('害羞', 0.5),\n ('娘娘', 0.5),\n ('一拍', 0.7499999999999999),\n ('到了', 0.5262327818078083),\n ('还想', 0.5922015819072117),\n ('拍拍', 0.7499999999999999),\n ('微笑', 0.7608695652173911),\n ('hhhhhhhh', 0.5),\n ('zyj', 0.5),\n ('带我', 0.5866236905721193),\n ('微笑', 0.7608695652173911),\n ('友好', 0.5999999999999999),\n ('善良', 0.8999999999999999),\n ('一丝', 0.7959183673469388),\n ('嗻', 0.5),\n ('我要', 0.5262327818078083),\n ('觉', 0.6282051282051285),\n ('晚安', 0.6486499411744434),\n ('yangmi', 0.5),\n ('晚安', 0.6486499411744434),\n ('旺柴', 0.8253755044676468),\n ('你数', 0.5),\n ('科导', 0.5),\n ('svm', 0.5),\n ('做', 0.6116015132408574),\n ('not', 0.5262327818078083),\n ('yet', 0.5262327818078083),\n ('看完', 0.7164608636766688),\n ('我子', 0.5),\n ('群里', 0.5),\n ('布吉岛', 0.5),\n ('公告', 0.5),\n ('想不考', 0.7667680470477884),\n ('做', 0.6116015132408574),\n ('svm', 0.5),\n ('延期', 0.7499999999999999),\n ('看得', 0.5875212430201505),\n ('宿舍', 0.692307692307692),\n ('我已经', 0.5262327818078083),\n ('图书馆', 0.9111111111111111),\n ('囧', 0.5),\n ('知识', 0.8716577540106951),\n ('教二', 0.5),\n ('还挺', 0.7739087900087525),\n ('是呢', 0.5262327818078083),\n ('我猜', 0.6578947368421054),\n ('考了', 0.8529411764705881),\n ('机考', 0.828266843571568),\n ('考吧', 0.8529411764705881),\n ('一勺', 0.5),\n ('池', 0.6046511627906977),\n ('还在', 0.5746682977321914),\n ('刷刷', 0.6666666666666666),\n ('激动', 0.7000000000000001),\n ('宿舍', 0.692307692307692),\n ('我现在', 0.5262327818078083),\n ('有种', 0.731865284974093),\n ('摆烂', 0.5),\n ('苗头', 0.7499999999999999),\n ('危', 0.8),\n ('延期', 0.7499999999999999),\n ('复习', 0.9615384615384615),\n ('完', 0.6633532140490392),\n ('延期', 0.7499999999999999),\n ('看不完', 0.5712899294071044),\n ('我现在', 0.5262327818078083),\n ('很想', 0.6889372464872354),\n ('流泪', 0.8),\n ('我要', 0.5262327818078083),\n ('写完', 0.6607175640981955),\n ('svm', 0.5),\n ('开始写', 0.523295070898042),\n ('生日快乐', 0.9606373884526408),\n ('谢谢', 0.5965665236051504),\n ('旺柴', 0.8253755044676468),\n ('超棒', 0.8999999999999999),\n ('qq', 0.5454545454545455),\n ('空间', 0.5348837209302327),\n ('文案', 0.7499999999999999),\n ('旺柴', 0.8253755044676468),\n ('哈哈哈哈', 0.8684210526315791),\n ('性格', 0.6111111111111112),\n ('超好', 0.6854890045674902),\n ('der', 0.5),\n ('确实', 0.6538461538461541),\n ('晚安', 0.6486499411744434),\n ('安', 0.7692307692307692),\n ('难过', 0.7499999999999999),\n ('流', 0.5321100917431194),\n ('的泪', 0.9230769230769229),\n ('凉快', 0.6666666666666666),\n ('Hurt', 0.5),\n ('看过', 0.5875212430201505),\n ('仿佛', 0.8281249999999999),\n ('忘', 0.5496688741721852),\n ('我看过', 0.5875212430201505),\n ('回头', 0.590909090909091),\n ('去看', 0.5747742299701318),\n ('像是', 0.5262327818078083),\n ('新', 0.6461038961038961),\n ('的知识', 0.8716577540106951),\n ('记得', 0.7848837209302325),\n ('期中', 0.7634320789299107),\n ('比吗', 0.5262327818078083),\n ('教学大纲', 0.9685140917525997),\n ('觉', 0.6282051282051285),\n ('一点点', 0.573529411764706),\n ('Worship', 0.5),\n ('Worship', 0.5),\n ('Worship', 0.5),\n ('Worship', 0.5),\n ('我也是', 0.5262327818078083),\n ('终于', 0.5870307167235498),\n ('泪目', 0.7500624229391235),\n ('泪目', 0.7500624229391235),\n ('每次', 0.652027027027027),\n ('free', 0.5),\n ('手机', 0.559322033898305),\n ('香了', 0.6494845360824741),\n ('我现在', 0.5262327818078083),\n ('最想做', 0.6674623793715114),\n ('事情', 0.5310492505353319),\n ('真不错', 0.8632519542194063),\n ('伞', 0.9285714285714286),\n ('猛男', 0.8916310915129264),\n ('袜', 0.5),\n ('Shy', 0.5),\n ('Shy', 0.5),\n ('Shy', 0.5),\n ('太猛', 0.7499999999999999),\n ('下了', 0.5041975308641975),\n ('雨', 0.7272727272727271),\n ('发挥', 0.7249999999999998),\n ('Doge', 0.5),\n ('Doge', 0.5),\n ('寝', 0.5),\n ('开心地', 0.7428571428571427),\n ('舍友', 0.6434981311546151),\n ('就行', 0.5495207667731629),\n ('最喜欢', 0.734047089548304),\n ('宿舍', 0.692307692307692),\n ('是啊', 0.5262327818078083),\n ('文明', 0.8108108108108106),\n ('那是什么', 0.5262327818078083),\n ('游戏', 0.7160804020100503),\n ('文明', 0.8108108108108106),\n ('打打杀杀', 0.5292745290373795),\n ('猛男', 0.8916310915129264),\n ('Sigh', 0.5),\n ('友好', 0.5999999999999999),\n ('不玩了', 0.5167644668185445),\n ('Doge', 0.5),\n ('我又', 0.5262327818078083),\n ('爱玩', 0.844422110725225),\n ('Broken', 0.5),\n ('图', 0.6198830409356725),\n ('送给你', 0.659217877094972),\n ('Whimper', 0.5),\n ('看了', 0.5875212430201505),\n ('Doge', 0.5),\n ('夜幕', 0.8),\n ('沉浸', 0.8800000000000001),\n ('式', 0.6956521739130431),\n ('剧本', 0.7142857142857141),\n ('实验', 0.9583333333333334),\n ('囧', 0.5),\n ('谢谢你', 0.5965665236051504),\n ('hhhhh', 0.5),\n ('还在', 0.5746682977321914),\n ('代码', 0.625),\n ('实验报告', 0.9817644440736273),\n ('代码', 0.625),\n ('代码', 0.625),\n ('我想看看你', 0.5441789912779675),\n ('写', 0.523295070898042),\n ('主要是', 0.5262327818078083),\n ('读者', 0.6601123595505617),\n ('写者', 0.5),\n ('那我', 0.5262327818078083),\n ('thx', 0.5),\n ('衰', 0.6666666666666666),\n ('会报', 0.5),\n ('段', 0.699140401146132),\n ('但也', 0.5262327818078083),\n ('比我', 0.5262327818078083),\n ('读者', 0.6601123595505617),\n ('写者', 0.5),\n ('读者', 0.6601123595505617),\n ('读', 0.7791970802919708),\n ('one', 0.5262327818078083),\n ('two', 0.5262327818078083),\n ('start', 0.5),\n ('时间', 0.5399449035812672),\n ('旺柴', 0.8253755044676468),\n ('旺柴', 0.8253755044676468),\n ('流泪', 0.8),\n ('艾', 0.6551724137931035),\n ('我上', 0.5099050763516304),\n ('节课', 0.8273856861449161),\n ('还没有', 0.5746682977321914),\n ('实验', 0.9583333333333334),\n ('🐮', 0.5),\n ('期末考', 0.9399947730622364),\n ('足够', 0.8899999999999999),\n ('平时', 0.634146341463415),\n ('就可以', 0.5262327818078083),\n ('足够', 0.8899999999999999),\n ('高', 0.6582579723940979),\n ('哈哈哈哈哈哈哈', 0.9751349273004098),\n ('好滴', 0.6644044980400812),\n ('我有', 0.5262327818078083),\n ('一段', 0.699140401146132),\n ('追逐', 0.9166666666666667),\n ('拼命', 0.5294117647058825),\n ('扒', 0.5555555555555554),\n ('衣服', 0.5555555555555558),\n ('是你哦', 0.5262327818078083),\n ('你还好吧', 0.6986352350530262),\n ('衣领', 0.5),\n ('可能会', 0.5539033457249072),\n ('勒到', 0.875),\n ('衰', 0.6666666666666666),\n ('衰', 0.6666666666666666),\n ('衰', 0.6666666666666666),\n ('扒', 0.5555555555555554),\n ('那就行', 0.5495207667731629),\n ('学生', 0.7037037037037036),\n ('那会子', 0.5),\n ('拉', 0.5093167701863355),\n ('旺柴', 0.8253755044676468),\n ('追逐', 0.9166666666666667),\n ('太刺激', 0.5466561431534561),\n ('拉', 0.5093167701863355),\n ('窒息', 0.5),\n ('发生', 0.5793357933579336),\n ('太猛', 0.7499999999999999),\n ('气氛', 0.7575757575757579),\n ('到位', 0.7643979057591622),\n ('电棒', 0.5),\n ('戳', 0.5),\n ('身上', 0.7024793388429755),\n ('整得', 0.5),\n ('我一个', 0.5047599337748345),\n ('站', 0.583756345177665),\n ('前排', 0.5),\n ('前排', 0.5),\n ('就挺', 0.7378104875804966),\n ('不用', 0.5836909871244634),\n ('旺柴', 0.8253755044676468),\n ('旺柴', 0.8253755044676468),\n ('我想起来了', 0.5441789912779675),\n ('过你', 0.5262327818078083),\n ('在后面', 0.5262327818078083),\n ('后排', 0.5),\n ('生存', 0.648148148148148),\n ('压力', 0.823529411764706),\n ('哈哈哈哈哈哈', 0.9751349273004098),\n ('走得', 0.5826296743063932),\n ('大爷', 0.7499999999999999),\n ('追', 0.5614035087719293),\n ('上了', 0.5099050763516304),\n ('终究', 0.8571428571428571),\n ('对你', 0.5262327818078083),\n ('下手', 0.6666666666666666),\n ('体验', 0.6464646464646463),\n ('每次', 0.652027027027027),\n ('我就', 0.5262327818078083),\n ('稳稳的幸福', 0.9078619559792114),\n ('hhhhhhhh', 0.5),\n ('都很', 0.6949877630914214),\n ('勇敢', 0.8160919540229885),\n ('泽泽', 0.890142453148024),\n ('单线', 0.5),\n ('去了', 0.5131611932815242),\n ('神奇', 0.879120879120879),\n ('女生', 0.5375),\n ('差距', 0.5043478260869565),\n ('悄悄地', 0.7499999999999999),\n ('假期', 0.5714285714285716),\n ('里', 0.5183574879227053),\n ('初中', 0.5084745762711864),\n ('同学', 0.7960526315789475),\n ('玩', 0.669724770642202),\n ('男', 0.5662650602409638),\n ('报团', 0.5),\n ('做', 0.6116015132408574),\n ('单线', 0.5),\n ('做', 0.6116015132408574),\n ('好久', 0.5428571428571431),\n ('思想', 0.8097560975609756),\n ('工作', 0.5691358024691356),\n ('跟我', 0.5262327818078083),\n ('旺柴', 0.8253755044676468),\n ('怂书', 0.6000661206146548),\n ('想着', 0.5441789912779675),\n ('泽泽', 0.890142453148024),\n ('她俩', 0.5),\n ('冲了', 0.5262327818078083),\n ('respect', 0.8333333333333333),\n ('剧情', 0.6315789473684209),\n ('推进', 0.7499999999999999),\n ('很快', 0.8784722222222223),\n ('Carry', 0.5),\n ('carry', 0.5),\n ('巨怕', 0.5),\n ('俩人', 0.7491606170077062),\n ('纷纷', 0.8666666666666666),\n ('还好', 0.6986352350530262),\n ('那你', 0.5262327818078083),\n ('okok', 0.5),\n ('昨天', 0.6433121019108282),\n ('补补', 0.5),\n ('晚安', 0.6486499411744434),\n ('Emm', 0.5),\n ('安', 0.7692307692307692),\n ('觉醒', 0.5),\n ('Emm', 0.5),\n ('觉醒', 0.5),\n ('hjh', 0.5),\n ('你知道', 0.5262327818078083),\n ('丝', 0.7959183673469388),\n ('我来', 0.5262327818078083),\n ('囧', 0.5),\n ('撸', 0.5),\n ('鼹鼠', 0.7499999999999999),\n ('我喜欢', 0.6994590939824207),\n ('博主', 0.5728800760809665),\n ('咖啡馆', 0.8333333333333333),\n ('鼹鼠', 0.7499999999999999),\n ('是因为', 0.5262327818078083),\n ('俩', 0.7142857142857141),\n ('喜欢', 0.6994590939824207),\n ('鼹鼠', 0.7499999999999999),\n ('旺柴', 0.8253755044676468),\n ('困', 0.5),\n ('微博', 0.6675930715082882),\n ('距离', 0.5341880341880341),\n ('高考', 0.9090909090909091),\n ('我又', 0.5262327818078083),\n ('忍不住', 0.6052631578947372),\n ('我去年', 0.621212121212121),\n ('什么意思啊', 0.5262327818078083),\n ('旺柴', 0.8253755044676468),\n ('旺柴', 0.8253755044676468),\n ('okok', 0.5),\n ('番', 0.5),\n ('的人', 0.5702515177797052),\n ('阳哥', 0.5),\n ('时间', 0.5399449035812672),\n ('里', 0.5183574879227053),\n ('都在', 0.5512110016420362),\n ('醉心', 0.9461558355137728),\n ('学习', 0.8347457627118644),\n ('好烦', 0.5),\n ('我做了', 0.6116015132408574),\n ('把握', 0.8684210526315791),\n ('机器人', 0.5),\n ('哈哈哈哈哈哈哈', 0.9751349273004098),\n ('你们的', 0.5262327818078083),\n ('app', 0.5),\n ('成熟', 0.8703703703703702),\n ('这是我', 0.5262327818078083),\n ('登录', 0.5),\n ('谷歌', 0.6104687877081492),\n ('账号', 0.7499999999999999),\n ('让我', 0.5262327818078083),\n ('验证', 0.6400000000000003),\n ('哦哦', 0.5262327818078083),\n ('谢红', 0.6634406841456313),\n ('老师', 0.8788819875776398),\n ('皱眉', 0.5),\n ('她想', 0.5441789912779675),\n ('袜', 0.5),\n ('555', 0.5),\n ('555', 0.5),\n ('可惜没有', 0.5798611111111113),\n ('敲打', 0.8333333333333333),\n ('舍友', 0.6434981311546151),\n ('在我', 0.5262327818078083),\n ('玩游戏', 0.821569050408676),\n ('敲打', 0.8333333333333333),\n ('想我们', 0.5441789912779675),\n ('听', 0.5900709219858153),\n ('旺柴', 0.8253755044676468),\n ('上次', 0.5099999999999996),\n ('过去了', 0.5262327818078083),\n ('过了', 0.5262327818078083),\n ('奥奥', 0.9540079860204392),\n ('呲牙', 0.5),\n ('段', 0.699140401146132),\n ('改掉', 0.7499999999999999),\n ('想着', 0.5441789912779675),\n ('感动', 0.8837920489296636),\n ('哈哈哈哈哈', 0.8684210526315791),\n ('数科', 0.7248986168407942),\n ('注释', 0.8333333333333333),\n ('代码', 0.625),\n ('是哪个', 0.5262327818078083),\n ('文件', 0.5277777777777779),\n ('写', 0.523295070898042),\n ('维', 0.6111111111111112),\n ('维', 0.6111111111111112),\n ('GMM', 0.5),\n ('self', 0.5262327818078083),\n ('implement', 0.5),\n ('衰', 0.6666666666666666),\n ('注释', 0.8333333333333333),\n ('我猜', 0.6578947368421054),\n ('注释', 0.8333333333333333),\n ('how', 0.5262327818078083),\n ('many', 0.5262327818078083),\n ('gmm', 0.5),\n ('类', 0.638888888888889),\n ('我猜', 0.6578947368421054),\n ('线', 0.5639097744360904),\n ('上课', 0.9166666666666667),\n ('到什么时候', 0.5262327818078083),\n ('听', 0.5900709219858153),\n ('这线', 0.5),\n ('上课', 0.9166666666666667),\n ('听', 0.5900709219858153),\n ('听课', 0.5),\n ('很舒服', 0.80854487752276),\n ('线下', 0.542102082305679),\n ('流泪', 0.8),\n ('就到', 0.5262327818078083),\n ('海淀', 0.5),\n ('又有', 0.5262327818078083),\n ('社会', 0.787781350482315),\n ('面', 0.5179063360881544),\n ('网课', 0.6055621612057934),\n ('难过', 0.7499999999999999),\n ('线上', 0.5477646582182203),\n ('游泳', 0.5859872611464972),\n ('课', 0.741935483870968),\n ('是在', 0.5262327818078083),\n ('梦里', 0.9090909090909091),\n ('游泳', 0.5859872611464972),\n ('课', 0.741935483870968),\n ('墨楠', 0.9056888206555996),\n ('老师', 0.8788819875776398),\n ('上交', 0.5),\n ('几个', 0.5262327818078083),\n ('健身', 0.5581395348837209),\n ('动作', 0.5500000000000004),\n ('特地', 0.6499999999999999),\n ('选了', 0.6456953642384105),\n ('动作', 0.5500000000000004),\n ('健美', 0.9157649558374518),\n ('课', 0.741935483870968),\n ('老师', 0.8788819875776398),\n ('给我们', 0.5262327818078083),\n ('好多', 0.5684647302904563),\n ('猛男', 0.8916310915129264),\n ('袜', 0.5),\n ('旺柴', 0.8253755044676468),\n ('困了', 0.5),\n ('看了', 0.5875212430201505),\n ('人类', 0.9292035398230089),\n ('肌肉', 0.9230769230769229),\n ('哈哈哈哈哈哈哈', 0.9751349273004098),\n ('看了', 0.5875212430201505),\n ('确实', 0.6538461538461541),\n ('最困', 0.5425296028096639),\n ('第一', 0.5503512880562061),\n ('我有', 0.5262327818078083),\n ('刷牙', 0.7272727272727275),\n ('听', 0.5900709219858153),\n ('走路', 0.5342465753424657),\n ('听', 0.5900709219858153),\n ('旺柴', 0.8253755044676468),\n ('旺柴', 0.8253755044676468),\n ('他凭', 0.5262327818078083),\n ('可以写', 0.523295070898042),\n ('文件', 0.5277777777777779),\n ('上过', 0.5099050763516304),\n ('两节课', 0.7800995719331799),\n ('都在', 0.5512110016420362),\n ('泡面', 0.7499999999999999),\n ('吃完饭', 0.5984161111546624),\n ('饱神', 0.6561837169364629),\n ('hhhhh', 0.5),\n ('饭饱神', 0.5787951414223784),\n ('起吗', 0.5262327818078083),\n ('舍友', 0.6434981311546151),\n ('喊着', 0.5517241379310347),\n ('把我', 0.5262327818078083),\n ('赶出去', 0.5262327818078083),\n ('放毒', 0.5),\n ('香到', 0.6494845360824741),\n ('精神', 0.7739726027397261),\n ('我在宿舍', 0.692307692307692),\n ('听课', 0.5),\n ('腰疼', 0.5),\n ('万恶', 0.7235812048349737),\n ('万恶', 0.7235812048349737),\n ('下桌', 0.5),\n ('就好了', 0.6558628208940429),\n ('旺柴', 0.8253755044676468),\n ('旺柴', 0.8253755044676468),\n ('观察力', 0.8985181820378912),\n ('一眼', 0.5443786982248525),\n ('那句', 0.5358744394618834),\n ('歌词', 0.875),\n ('变', 0.6016597510373444),\n ('照顾', 0.9642857142857143),\n ('孤陋寡闻', 0.8305553368501174),\n ('东西', 0.5285524568393094),\n ('zyj', 0.5),\n ('写作业', 0.8622431243278534),\n ('对了', 0.5262327818078083),\n ('男生', 0.6041700673037205),\n ('寝室', 0.7499999999999999),\n ('要啊', 0.5262327818078083),\n ('挤了', 0.5833333333333336),\n ('平衡', 0.7547169811320755),\n ('旺柴', 0.8253755044676468),\n ('挺快', 0.8666666666666666),\n ('翻车', 0.5),\n ('衰', 0.6666666666666666),\n ('那你写吧', 0.523295070898042),\n ('我走了', 0.5826296743063932),\n ('快去', 0.7057257080365441),\n ('祝你', 0.8615384615384615),\n ('翻车', 0.5),\n ('祝你', 0.8615384615384615),\n ('翻车', 0.5),\n ('我刚刚', 0.5918367346938779),\n ('听说', 0.5778894472361809),\n ('要上网', 0.5694915254237288),\n ('课到', 0.741935483870968),\n ('sad', 0.5),\n ('熄了', 0.8),\n ('网课', 0.6055621612057934),\n ('sadsad', 0.5),\n ('是呢', 0.5262327818078083),\n ('在教', 0.5),\n ('我也是', 0.5262327818078083),\n ('要出', 0.5573294629898403),\n ('宿舍', 0.692307692307692),\n ('在宿舍里', 0.6855433751296961),\n ('叹气', 0.8),\n ('上派', 0.5),\n ('老师', 0.8788819875776398),\n ('网课', 0.6055621612057934),\n ('我必', 0.7000000000000001),\n ('我听', 0.5900709219858153),\n ('线', 0.5639097744360904),\n ('下课', 0.724683891795274),\n ('讲完', 0.7624165625454951),\n ('叹气', 0.8),\n ('衰', 0.6666666666666666),\n ('文昌', 0.5),\n ('老师', 0.8788819875776398),\n ('讲完', 0.7624165625454951),\n ('你写', 0.523295070898042),\n ('旺柴', 0.8253755044676468),\n ('衰', 0.6666666666666666),\n ('再见', 0.6875000000000002),\n ('还有课吗', 0.741935483870968),\n ('微笑', 0.7608695652173911),\n ('一下子', 0.6333333333333333),\n ('叹气', 0.8),\n ('节', 0.6493506493506495),\n ('图论', 0.5),\n ('早', 0.5225225225225225),\n ('痛苦', 0.6893939393939396),\n ('击', 0.5999999999999999),\n ('怀抱', 0.7499999999999999),\n ('一下子', 0.6333333333333333),\n ('仨', 0.5),\n ('再见', 0.6875000000000002),\n ('吃饭', 0.5330882352941176),\n ('是呢', 0.5262327818078083),\n ('去吃', 0.5056324315808706),\n ('饭饱神', 0.5787951414223784),\n ('吃啊', 0.518716577540107),\n ('北区', 0.5),\n ('都行', 0.5742645071309064),\n ('外卖', 0.7499999999999999),\n ('害羞', 0.5),\n ('上网', 0.5694915254237288),\n ('课', 0.741935483870968),\n ('吃饭', 0.5330882352941176),\n ('生活', 0.83150800336984),\n ('里', 0.5183574879227053),\n ('乐趣', 0.8837209302325582),\n ('hjh', 0.5),\n ('我觉得', 0.5262327818078083),\n ('参不参加', 0.6750293858628962),\n ('操心', 0.6666666666666666),\n ('是啊', 0.5262327818078083),\n ('人大', 0.56),\n ('关心', 0.8181818181818182),\n ('引人关注', 0.775200938134529),\n ('作业', 0.8636363636363636),\n ('结束', 0.5140845070422536),\n ('共享', 0.8421052631578949),\n ('屏幕', 0.5086757990867581),\n ('乱点', 0.5),\n ('怎么这么', 0.5262327818078083),\n ('教你', 0.5),\n ('屏幕', 0.5086757990867581),\n ('还在', 0.5746682977321914),\n ('写', 0.523295070898042),\n ('ddl', 0.5),\n ('衰', 0.6666666666666666),\n ('ddl', 0.5),\n ('人要', 0.5702515177797052),\n ('ddl', 0.5),\n ('亚子', 0.5),\n ('旺柴', 0.8253755044676468),\n ('节课', 0.8273856861449161),\n ('我正', 0.6262135922330102),\n ('和你', 0.5262327818078083),\n ('天使', 0.8999999999999999),\n ('在人间', 0.5547445255474455),\n ('大哭', 0.7096766696975894),\n ('罗马帝国', 0.5),\n ('建', 0.5833333333333336),\n ('谢谢你', 0.5965665236051504),\n ('nice', 0.8),\n ('又是', 0.5262327818078083),\n ('一波', 0.5),\n ('风好', 0.5199064996591567),\n ('怀念', 0.7222222222222222),\n ('晴天', 0.5),\n ('升', 0.5192307692307692),\n ('到我', 0.5262327818078083),\n ('短裤', 0.5),\n ('可爱多', 0.8088888888888889),\n ('π', 0.5),\n ('老师', 0.8788819875776398),\n ('卡出', 0.5),\n ('旺柴', 0.8253755044676468),\n ('派', 0.6842105263157895),\n ('老师', 0.8788819875776398),\n ('手机', 0.559322033898305),\n ('震', 0.6842105263157895),\n ('流泪', 0.8),\n ('没声', 0.5),\n ('第一个', 0.5503512880562061),\n ('布置了', 0.7258064516129034),\n ('题目', 0.7959183673469388),\n ('让我们', 0.5262327818078083),\n ('做', 0.6116015132408574),\n ('脖子', 0.7499999999999999),\n ('酸', 0.6666666666666666),\n ('坐着', 0.6758409785932725),\n ('哈哈哈哈哈哈哈', 0.9751349273004098),\n ('奋发图强', 0.6666666666666666),\n ('你在', 0.5262327818078083),\n ('教室', 0.9411764705882353),\n ('图书馆', 0.9111111111111111),\n ('🐮', 0.5),\n ('不愧', 0.9803921568627451),\n ('图书馆', 0.9111111111111111),\n ('很安静', 0.8226299498464533),\n ('室内', 0.5079365079365078),\n ('刚刚好', 0.713296231538588),\n ('很舒服', 0.80854487752276),\n ('很适合', 0.7508703791474521),\n ('hhhhhhhhhhh', 0.5),\n ('梦到', 0.6847826086956522),\n ('在上', 0.5099050763516304),\n ('数', 0.6611570247933886),\n ('科导', 0.5),\n ('看到你了', 0.5262327818078083),\n ('教室', 0.9411764705882353),\n ('突然想起', 0.6999999999999997),\n ('阳哥', 0.5),\n ('教二', 0.5),\n ('草坪', 0.7499999999999999),\n ('狼人', 0.818614071699468),\n ('海淀', 0.5),\n ('静默', 0.5),\n ('危了', 0.8),\n ('谣言', 0.851941551550238),\n ('外卖', 0.7499999999999999),\n ('静默', 0.5),\n ('那就好', 0.6558628208940429),\n ('胜利', 0.7058823529411765),\n ('胜利', 0.7058823529411765),\n ('对了', 0.5262327818078083),\n ('你会', 0.5539033457249072),\n ('狼人', 0.818614071699468),\n ('狼人', 0.818614071699468),\n ('好丸', 0.5),\n ('强', 0.6761229314420805),\n ('完', 0.6633532140490392),\n ('非常容易', 0.5262327818078083),\n ('节奏', 0.6956521739130435),\n ('玩', 0.669724770642202),\n ('游戏', 0.7160804020100503),\n ('偷袭', 0.5),\n ('到时候', 0.5262327818078083),\n ('就看', 0.5875212430201505),\n ('神仙', 0.8333333333333333),\n ('打架', 0.6153846153846156),\n ('全场', 0.5),\n ('沉默', 0.8636363636363636),\n ('丸', 0.5),\n ('更容易', 0.6241768579492005),\n ('旺柴', 0.8253755044676468),\n ('旺柴', 0.8253755044676468),\n ('完丸', 0.5),\n ('hhhhhh', 0.5),\n ('敲打', 0.8333333333333333),\n ('敲打', 0.8333333333333333),\n ('敲打', 0.8333333333333333),\n ('作业', 0.8636363636363636),\n ('科', 0.5999999999999999),\n ('期中', 0.7634320789299107),\n ('没考', 0.7409278908739213),\n ('运筹学', 0.8807485814440624),\n ('个性化', 0.625),\n ('选修', 0.6666666666666666),\n ('期中', 0.7634320789299107),\n ('图论', 0.5),\n ('期末', 0.7499999999999999),\n ('旺柴', 0.8253755044676468),\n ('奸笑', 0.5576042581707898),\n ('放假', 0.5000000000000004),\n ('考试', 0.9000000000000001),\n ('宿舍里', 0.6855433751296961),\n ('哀鸿遍野', 0.9821799895872715),\n ('寝', 0.5),\n ('emo', 0.5),\n ('想要', 0.5441789912779675),\n ('痛快', 0.8999999999999999),\n ('话', 0.517274472168906),\n ('苦涩', 0.875),\n ('上个', 0.6363636363636364),\n ('学期', 0.875),\n ('考试', 0.9000000000000001),\n ('把我', 0.5262327818078083),\n ('够惨', 0.8013248721682867),\n ('学期', 0.875),\n ('变本加厉', 0.5),\n ('叹气', 0.8),\n ('叹气', 0.8),\n ('叹气', 0.8),\n ('开心', 0.7428571428571427),\n ('突然想起来', 0.5441789912779675),\n ('找到', 0.5778781038374716),\n ('队友', 0.5),\n ('你知道', 0.5262327818078083),\n ('一个叫', 0.5047599337748345),\n ('米', 0.5038759689922481),\n ('丰源', 0.5),\n ('的人', 0.5702515177797052),\n ('听过', 0.5900709219858153),\n ('旺柴', 0.8253755044676468),\n ('ta', 0.5),\n ('男生', 0.6041700673037205),\n ('女生', 0.5375),\n ('有道理', 0.590733590733591),\n ('旺柴', 0.8253755044676468),\n ('牵手', 0.567010878097331),\n ('成功', 0.6302816901408453),\n ('寝室', 0.7499999999999999),\n ('打游戏', 0.7160804020100503),\n ('你怎么知道的', 0.5262327818078083),\n ('旺柴', 0.8253755044676468),\n ('还在玩吗', 0.7115320752908174),\n ('00', 0.5999999999999999),\n ('就到', 0.5262327818078083),\n ('宿舍', 0.692307692307692),\n ('我走了', 0.5826296743063932),\n ('对呀', 0.5262327818078083),\n ('那局', 0.5),\n ('结束', 0.5140845070422536),\n ('热闹', 0.8730158730158731),\n ('h', 0.5),\n ('我喜欢', 0.6994590939824207),\n ('代码', 0.625),\n ('苦涩', 0.875),\n ('代码', 0.625),\n ('运筹学', 0.8807485814440624),\n ('要到', 0.5262327818078083),\n ('2000', 0.6206896551724135),\n ('行', 0.5495207667731629),\n ('大哭', 0.7096766696975894),\n ('代码', 0.625),\n ('debug', 0.5),\n ('血压高', 0.6342546484425678),\n ...]"
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pos_words_list"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-31T13:33:44.294659700Z",
     "start_time": "2024-01-31T13:33:44.267126700Z"
    }
   },
   "execution_count": 9
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "sort() takes no positional arguments",
     "output_type": "error",
     "traceback": [
      "\u001B[1;31m---------------------------------------------------------------------------\u001B[0m",
      "\u001B[1;31mTypeError\u001B[0m                                 Traceback (most recent call last)",
      "Cell \u001B[1;32mIn[11], line 1\u001B[0m\n\u001B[1;32m----> 1\u001B[0m \u001B[43mpos_words_list\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43msort\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;28;43;01mlambda\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[43mx\u001B[49m\u001B[43m:\u001B[49m\u001B[43mx\u001B[49m\u001B[43m[\u001B[49m\u001B[38;5;241;43m1\u001B[39;49m\u001B[43m]\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mreverse\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[38;5;28;43;01mTrue\u001B[39;49;00m\u001B[43m)\u001B[49m\n\u001B[0;32m      2\u001B[0m neg_words_list\u001B[38;5;241m.\u001B[39msort(\u001B[38;5;28;01mlambda\u001B[39;00m x:x[\u001B[38;5;241m1\u001B[39m], reverse\u001B[38;5;241m=\u001B[39m\u001B[38;5;28;01mFalse\u001B[39;00m)\n\u001B[0;32m      4\u001B[0m \u001B[38;5;28;01mwith\u001B[39;00m \u001B[38;5;28mopen\u001B[39m(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m./neg_words_list.txt\u001B[39m\u001B[38;5;124m\"\u001B[39m, \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mw\u001B[39m\u001B[38;5;124m\"\u001B[39m, encoding\u001B[38;5;241m=\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mutf8\u001B[39m\u001B[38;5;124m\"\u001B[39m) \u001B[38;5;28;01mas\u001B[39;00m t:\n",
      "\u001B[1;31mTypeError\u001B[0m: sort() takes no positional arguments"
     ]
    }
   ],
   "source": [
    "pos_words_list.sort(lambda x:x[1], reverse=True)\n",
    "neg_words_list.sort(lambda x:x[1], reverse=False)\n",
    "\n",
    "with open(\"./neg_words_list.txt\", \"w\", encoding=\"utf8\") as t:\n",
    "    for word, rate in neg_words_list:\n",
    "        t.write(f\"{word}\\t{rate}\\n\")\n",
    "\n",
    "with open(\"./pos_words_list.txt\", \"w\", encoding=\"utf8\") as t:\n",
    "    for word, rate in pos_words_list:\n",
    "        t.write(f\"{word}\\t{rate}\\n\")"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-31T13:34:48.299984400Z",
     "start_time": "2024-01-31T13:34:48.160942100Z"
    }
   },
   "execution_count": 11
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "venv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
